{% extends "common/layout_main.html" %}
{% block content %}
{% include "common/tab_food.html" %}
<div class="row">
    <div class="col-lg-12">
        <form class="form-inline wrap_search">
            <div class="row  m-t p-w-m">
                <div class="form-group">
                    <select name="status" class="form-control inline">
                        <option value="-1">请选择状态</option>
                        {% for tem_key in status_mapping %}
                        <option value="{{ tem_key }}" {% if tem_key== search_con.status %} selected {% endif %}>
                            {{ status_mapping[tem_key] }}
                        </option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <hr>
            <div class="row">
                <div class="col-lg-12">
                    <a class="btn btn-w-m btn-outline btn-primary pull-right"
                       href="{{ buildUrl('/food/cat-set') }}">
                        <i class="fa fa-plus"></i>分类
                    </a>
                </div>
            </div>

        </form>
        <table class="table table-bordered m-t">
            <thead>
            <tr>
                <th>序号</th>
                <th>分类名称</th>
                <th>状态</th>
                <th>权重</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% if list %}
            {% for item in list %}
            <tr>
                <td>{{ item.id }}</td>
                <td>{{ item.name }}</td>
                <td>{{ item.status_desc }}</td>
                <td>{{ item.weight }}</td>
                <td>
                    {% if item.status == 1 %}
                    <a class="m-l" href="{{ buildUrl('/food/cat-set') }}?id={{ item.id }}">
                        <i class="fa fa-edit fa-lg"></i>
                    </a>
                    <a class="m-l remove" href="javascript:void(0);" data="{{ item.id }}">
                        <i class="fa fa-trash fa-lg"></i>
                    </a>
                    {% else %}
                    <a class="m-l recover" href="javascript:void(0);" data="{{ item.id }}">
                        <i class="fa fa-rotate-left fa-lg"></i>
                    </a>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
            {% else %}
            <tr>
                <td colspan="5">暂无数据~~</td>
            </tr>
            {% endif %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}
{% block js %}
<script src="{{ buildStaticUrl('/js/food/cat.js') }}"></script>
{% endblock %}
